package learning.groovy.swing

import groovy.swing.SwingBuilder
import java.awt.BorderLayout
import groovy.swing.SwingBuilder
//import java.awt.BorderLayout as BL

class GroovySwing {

	static main(args) {
		def swing = new SwingBuilder()
		def count = 0
		def textlabel
		def frame = swing.frame(title:'Frame', size:[300, 300]) {
			borderLayout()
			textlabel = label(text:"Clicked ${count} time(s).",
			constraints: BorderLayout.NORTH)
			button(text:'Click Me',
			actionPerformed: {
				count++; textlabel.text =
				"Clicked ${count} time(s)."; println "clicked"
			},
			constraints:BorderLayout.SOUTH)
		}
		frame.pack()
		frame.show()
	}
}
